﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System;

[Serializable]
public class Item {

	public int id;
	public string name;
	public string icon;
	public int price;
	public string desc;
	public int getPath;	
	public int itemType;
	public string limitTime;

	public Item(int _id, string _name, string _icon, 
		int _price, string _desc, int _getPath, int _itemType, string _limitTime){
			id = _id;
			name = _name;
			icon = _icon;
			price = _price;
			desc = _desc;
			getPath = _getPath;
			itemType = _itemType;
			limitTime = _limitTime;
	}
	public Item(){}

    public Item DeepClone()
    {
        using (Stream objectStream = new MemoryStream())
        {
            IFormatter formatter = new BinaryFormatter();
            formatter.Serialize(objectStream, this);
            objectStream.Seek(0, SeekOrigin.Begin);
            return formatter.Deserialize(objectStream) as Item;
        }
    }
}
